1. Set the UID and EUID of the process when trying to switch to a
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Tue, 8 Nov 2005 11:00:23 +0000 (12:00 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Tue, 8 Nov 2005 11:00:23 +0000 (12:00 +0100)
   non-root user.
2. Better handle the debug-printing inside the console

Signed-off-by: Dan Smith <danms@us.ibm.com>
tools/xm-test/lib/XmTestLib/Console.py
tools/xm-test/lib/XmTestLib/Test.py

index 8be9235c0a5e15873126e9d055c2b04bb86e06c4..b4ef40fe57adb61c28981b042ebce8a0f848d46b 100644 (file)
@@ -167,6 +167,8 @@ class XmConsole:
             if self.consoleFd in i:
                 try:
                     str = os.read(self.consoleFd, 1)
+                    if self.debugMe:
+                        sys.stdout.write(str)
                     bytes += 1
                 except:
                     raise ConsoleError("Failed to read from console (fd=%i)"
@@ -179,8 +181,6 @@ class XmConsole:
                                    % self.limit)
 
             if str == "\n":
-                if self.debugMe:
-                    print "%s\n" % line
                 if lines > 0:
                     output += line + "\n"
                     if saveHistory:
index 02ff7e96b20dbce666f7aeef1ad1d64a8d81c2c2..728ae12f053b94433e9546f004fb37fc3966edfa 100644 (file)
@@ -125,7 +125,7 @@ def becomeNonRoot():
         allusers = pwd.getpwall()
         for u in allusers:
             if u[0] == "nobody":
-                os.seteuid(u[2])
+                os.setreuid(u[2], u[2])
                 break
         if os.geteuid() == 0:
             FAIL("Could not become a non-root user")